import { baseUrlConfig } from '@/config/config';
import request from '@/utils/request'

const bastPath = baseUrlConfig.processBaseUrl

export interface PageListType {
    pageNum: number,
    pageSize: number,
    condition?: {
        goodsName?: string,
        goodsCode?: string,
        pickUpPlace?: string,
        startTime?: string,
        endTime?: string,
        storePosition?: string,
        storeTerminal?: string,
        storeTime?: string,
        goodsType?: string,
        isPickUp?: string,
        taskProcess?: string,
        isDefaultWarehouse?: string
    }
}

export interface ProcessType {
    content: {
        creator: {
            id: string,
            name: string,
            organId: string,
            organName: string
        },
        createTime: string
    },
    id: string,
    variables: {
        switch: string
    }
}
export interface ConditionType {
    columns?: string,
    endTime?: string,
    expired?: number,
    goodsCode?: string,
    goodsName?: string,
    goodsType?: string,
    id?: number,
    keyWord?: string,
    pickUpPlace?: string,
    startTime?: string,
    storePosition?: string,
    storeTerminal?: string,
    storeTime?: string,
    taskProcess: string
}

// 获取物品类型
export const queryGoodsTypeFind = () => {
    return request({
        url: bastPath + '/lose/goodsType/find',
        method: 'post',
        data: {}
    })
}
// 获取分页列表
export const queryGoodsRegFindPage = (data: PageListType) => {
    return request({
        url: bastPath + '/lose/goodsReg/find/page',
        method: 'post',
        data
    })
}
// 查询所有物品列表
export const queryGoodsRegFindList = (taskProcess: string) => {
    return request({
        url: bastPath + '/lose/goodsReg/find',
        method: 'post',
        data:{taskProcess}
    })
}
// 查询物品详情
export const queryGoodsRegDetail = (data: { regId: string; taskId: string }) => {
    return request({
        url: bastPath + '/lose/goodsReg/detail',
        method: 'post',
        data
    })
}

// 导出列表
export const outInStorageExportXls = (condition: ConditionType) => {
    return request({
        url: bastPath + '/lose/outInStorage/exportXls',
        method: 'post',
        data:condition,
        responseType: 'blob'
    })
}
